package com.negocio.beans;

import java.util.ArrayList;
import java.util.List;

import javax.ejb.LocalBean;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

import com.negocio.dao.CompCurrDAO;
import com.negocio.entidades.CompCurr;
import com.negocio.entidades.Usuario;
import com.negocio.facade.CompCurrRemote;

@Stateless
@LocalBean
public class CompCurrBean implements CompCurrRemote {
	
	
	@PersistenceContext(unitName = "SystemgedBD")
	private EntityManager em;
	
	
	/**
     * Default constructor. 
     */
    public CompCurrBean() {
        // TODO Auto-generated constructor stub
    }

	@Override
	public CompCurr salvar(CompCurr c) throws Exception {
		CompCurrDAO dao = new CompCurrDAO(em);
		return dao.salvar(c);
	}

	@Override
	public void excluir(long id) {
		CompCurrDAO dao = new CompCurrDAO(em);
		 dao.excluir(id);
	}

	@Override
	public List<CompCurr> listar() {
		CompCurrDAO dao = new CompCurrDAO(em);
		List<CompCurr> componentes = new ArrayList<CompCurr>();
		componentes = dao.listar();
		return componentes;
	}

	@Override
	public CompCurr consultarPorId(long id) {
		CompCurrDAO dao = new CompCurrDAO(em);
		return dao.consultarPorId(id);
	}
	
	@Override
	public List<Usuario> listarProfessores() {
		CompCurrDAO dao = new CompCurrDAO(em);
		List<Usuario> usuarios = new ArrayList<Usuario>();
		usuarios = dao.listarProfessores();
		return usuarios;
	}


}
